package com.shanghaionstar.enumtype;

public enum DealerBrandType {

    DEFAULT("ALL"),

    BUICK("BUICK"),

    CHEVROLET("CHEVROLET"),

    CADILLAC("CADILLAC"),

    WTK("WTK");
    private String value;

    DealerBrandType(String value) {
        this.value = value;
    }

    public String value() {
    name();
        return value;

    }

//    public String name() {
//        return value;
//    }

    public static DealerBrandType fromValue(String v) {

        return valueOf(v);

    }

    public static String getBriefNameByDesc(String desc) {
        if (desc.contains("凯迪拉克"))
            return "凯迪拉克";
        else if (desc.contains("别克"))
            return "别克";
        else if (desc.contains("雪佛兰"))
            return "雪佛兰";
        else
            return "别克";
    }

    public static DealerBrandType getDealerBrandTypeByDesc(String desc) {
        if (desc.contains("凯迪拉克") || desc.toLowerCase().contains("Cadillac".toLowerCase()))
            return DealerBrandType.CADILLAC;
        else if (desc.contains("别克") || desc.toLowerCase().contains("Buick".toLowerCase()))
            return DealerBrandType.BUICK;
        else if (desc.contains("雪佛兰") || desc.toLowerCase().contains("Chevrolet".toLowerCase()))
            return DealerBrandType.CHEVROLET;
        else
            return DealerBrandType.DEFAULT;
    }
}
